/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bolao.ui.beans;

import bolao.dominio.Categoria;
import bolao.dominio.Item;
import bolao.dominio.Menu;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author 002824992500
 */
@ManagedBean
@ViewScoped
public class MenuJsfBean extends BaseCRUDJSFBean {

    private static final Logger log = LoggerFactory.getLogger(MenuJsfBean.class);

    //private static final Logger log = Logger.getLogger(ItemJSFBean.class.getName());


    public Menu getMenu() {
        return getObjSelecionado();
    }

    public void setMenu(Menu menu) {
        setObjSelecionado(menu);
    }

    private List<Menu> menuList = new ArrayList<Menu>();

    public List<Menu> getMenuList() {
        return menuList;
    }
    
    public MenuJsfBean() {
    }

    @Override
    public void setup() {
        try {
            renovarTabela();

            //setPaginaForm("form_menu");
            setPaginaListagem("list_menu");
            setCrudClass(Menu.class);

        } catch (Exception e) {
            String err = "Erro na inicialização: " + e.getMessage();
            error(err);
            //log.error(err, e);
        }        
    }

    @Override
    protected void renovarTabela() {        
        this.menuList = getCrudService().findAll(Menu.class);
    }    

}
